package day09.HashMapTest;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

public class Test1 {
    public static void main(String[] args) {
        HashMap<Integer, String> map = new HashMap<>();
        map.put(9527,"唐伯虎");
        map.put(9828,"秋香");
        map.put(9829,"祝枝山");
        map.put(9830,"旺财");
        map.put(9831,"小强");
        map.put(9832,"石榴姐");
        map.put(9833,"秋香");
        map.put(9833,"如花");//重复的键，新的值会覆盖旧的值
        System.out.println(map.size());
        System.out.println(map);
        System.out.println(map.get(9527));
        System.out.println(map.get(9999));
        System.out.println(map.remove(9530));
        System.out.println(map);
        Set<Integer> set = map.keySet();
        for(Iterator<Integer> it = set.iterator(); it.hasNext(); ){
            Integer k = it.next();
            String v = map.get(k);
            System.out.println(v);
        }

    }
}
